#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
stack<int> stk;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s; cin >> s;
	int tmp = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '@') break;
		else if (s[i] == '.') {
			stk.push(tmp);
			tmp = 0;
		}
		else if (s[i] >= '0' && s[i] <= '9') {
			tmp = tmp * 10 + s[i] - '0';
		}
		else if (s[i] == '+') {
			int x = stk.top(); stk.pop(); 
			int y = stk.top(); stk.pop();
			stk.push(y + x);
		}
		else if (s[i] == '-') {
			int x = stk.top(); stk.pop();
			int y = stk.top(); stk.pop();
			stk.push(y - x);
		}
		else if (s[i] == '*') {
			int x = stk.top(); stk.pop();
			int y = stk.top(); stk.pop();
			stk.push(y * x);
		}
		else if (s[i] == '/') {
			int x = stk.top(); stk.pop();
			int y = stk.top(); stk.pop();
			stk.push(y / x);
		}
	}
	cout << stk.top() << '\n';
	return 0;
}